public class SolutionLCP22 {
    public int paintingPlan(int n, int k) {
        int ans=0;
        if (k==n*n){
            return 1;
        }
        int[][] f={{1},{1,1},{1,2,1},{1,3,3,1},{1,4,6,4,1},{1,5,10,10,5,1},{1,6,15,20,15,6,1}};
        for (int i=0;i<=n;i++) {
            for (int j=0;j<=n;j++){
                if ((i+j)*n-i*j==k){
                    ans+=f[n][i]*f[n][j];
                }
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new SolutionLCP22().paintingPlan(2,4));
    }
}
